<?php
include_once("conn.php");
$webname = $_POST["webname"];
$webaddress = $_POST["webaddress"];
$cid = $_POST["cid"];

$mark=false;
function Check_webName($webaddress)
{
	if(preg_match("/[a-zA-Z0-9]+\.[a-zA-Z0-9]{2,6}/",$webaddress) )
	{
		return true;

	}

}
$mark=Check_webName($webaddress);
if($mark==true)
{
	$query = "insert into link(webname,webaddress) value('".$webname."','".$webaddress."')";
	$result = mysql_query($query);
	$query = "select lid from link where webname='".$webname."' && webaddress='".$webaddress."' order by `lid` desc limit 1";
	$result = mysql_query($query);
	while( $lid = mysql_fetch_array($result) )
	{
		$a=$lid["lid"];
	}
	$query = "insert into cate_link(cid,lid) value('".$cid."','".$a."')";
	mysql_query($query);
	$json['a']=$a;
	$json['webname11']=$webname;
	$json['webaddress11']=$webaddress;

	echo json_encode($json);

}

?>